import { getComponents, getRouteName } from '/@/utils/helper'

const components = getComponents(
  import.meta.glob('../../pages/sys/**/*.vue')
)

const routes = []
const sysRoutes = Object.keys(components).map(rawPath => {
  const path = rawPath.replace(/^\/sys/, '')

  return {
    path,
    name: getRouteName(path),
    component: components[rawPath]
  }
})

export default [
  ...routes,
  ...sysRoutes
]
